Preview - Intro To Learning With Computational Models

A not-so-sneak peek into the code behind the model


Here's a model of wildfire that a team of researchers tried to modify. But it does not run as they expected. In fact, it broke, it does not run at all.

Can we help them fix it?


Questions

Please answer the questions below.

Setup the model. What is the mistake (or what computer science people call 'bug') in the model?

 


Did you observe that after you press 'setup', you see blue colored trees. Maybe the mistake in the code is about color of the tree. Maybe the color of the tree is set to 'blue' instead of 'green' by mistake.

Click on the blue bar that says 'NetLogo Code'. You can find it below the big square in the model.

Where does it say 'blue' in the code? And there does it say 'green' in the code?


You can fix the bug! Go to a line that say 'blue' where it should have been 'green'. Change the code.

Click on "Recompile code" and run the model again. Does it work now?

Can you explain why it did not work before?


These NetLogo computational models allow users to change the code and observe the effect of those changes.That is one very important feature of these Emergent Systems Microworlds, that you can play with those by changing the parameters such as 'density' or by changing the code as well.

Now try to read the code. Write a line in the code below and explain how it affects the way the model would behave. 

For example, 

set initial-trees count patches with [pcolor = green]

This line above, sets a value for a variable 'initial-tree' by counting the patches that have pcolor (patch-color). This line is written in NetLogo language that the NetLogo compiler understands.

NetLogo language is designed to be easy to understand for humans. Pick another line in the code and explain what it could mean.   


Notes

These notes will appear on every page in this lesson so feel free to put anything here you'd like to keep track of.